﻿using System.IO;

namespace FileWatcher.Action
{
    public abstract class ActionBase : IAction
    {
        private bool m_delete;

        public abstract string Name { get; }

        public ActionBase(bool delete)
        {
            this.m_delete = delete;
        }

        protected abstract void Action(Node node);

        public void Process(Node node)
        {
            this.Action(node);

            if (this.m_delete)
                File.Delete(node.Location);
        }
    }
}